package demo1;

// 继承的概念
class Animal {
    public String name;
    public int age;

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void eat() {
        System.out.println(this.name + "正在吃饭");
    }
}

class Dog extends Animal {

    public Dog(String name, int age) {
        super(name, age); // 调用父类的构造方法 帮助初始化
    }

    void bark() {
        System.out.println(this.name + "正在犬吠");
    }
}

//class Cat extends Animal {
//
//    void mew() {
//        System.out.println(this.name + "正在喵喵叫");
//    }
//}

public class Test {
    public static void main(String[] args) {
        Dog dog1 = new Dog("mimi", 10);
        dog1.name = "111";
        dog1.bark();
        dog1.eat();
    }

}
